Re: problem fetching currval of sequence
От | Charles Hauser |
---|---|
Тема | Re: problem fetching currval of sequence |
Дата | |
Msg-id | a05111b03b975e0252d02@[152.3.11.193] обсуждение исходный текст |
Ответ на | Re: problem fetching currval of sequence (Josh Berkus <josh@agliodbs.com>) |
Ответы |
Re: problem fetching currval of sequence
|
Список | pgsql-sql |
Josh and Tom,
I have checked for typos, rewritten a smaller script and checked the table setup (\d gb, see below) and
$result = $conn->exec(
"SELECT currval('gb_gb_id_seq');"
);
continues to return the error:
ERROR: gb_gb_id_seq.currval is not yet defined in this session
I know this script worked in the past, but I have not used it recently. We are running PostgreSQL 7.1.3. It would be great if this would work as I have several scripts which operate in a similar manner for different TABLES, but if it won't work I'll work around it.
Suggestions for the best way to get the value for the gb_id after an INSERT?
chlamy_est=> \d gb
Table "gb"
Attribute | Type | Modifier
-----------+-----------------------+--------------------------------------------------
gb_id | integer | not null default nextval('"gb_gb_id_seq"'::text)
clone_id | integer |
accn | character varying(12) | not null
gi | integer | not null
Index: gb_pkey
Table "gb"
Attribute | Type | Modifier
-----------+-----------------------+--------------------------------------------------
gb_id | integer | not null default nextval('"gb_gb_id_seq"'::text)
clone_id | integer |
accn | character varying(12) | not null
gi | integer | not null
Index: gb_pkey
Hmm, that sure looks like it should work. I can only counsel looking
for silly errors (typos, not running the same copy of the script that you
for silly errors (typos, not running the same copy of the script that you
edited, etc). Also double-check that gb.gb_id has the column default
nextval('gb_gb_id_seq') (try psql's "\d gb" command).
--
Regards,
Chuck
Chuck
В списке pgsql-sql по дате отправления: